package com.briup.bms.web.controller;

import com.briup.bms.bean.SInventory;
import com.briup.bms.common.utils.Result;
import com.briup.bms.service.SInventoryService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Paocha
 * @date: 2021-11-23-13:25
 */
@Api(tags = "存货信息服务")
@RestController
@RequestMapping("/inventory")
public class InventoryController {
    @Autowired
    SInventoryService inventoryService;

    @GetMapping("/")
    public Result<PageInfo<SInventory>> findByPageHelper(
            @RequestParam(defaultValue = "1") int pageNum,
            @RequestParam(defaultValue = "5") int pageSize) {
        return Result.success(inventoryService.selectByPageHepler(pageNum,pageSize));
    }

    public Result<PageInfo<SInventory>> findByCondition(
            @RequestParam(defaultValue = "1") int pageNum,
            @RequestParam(defaultValue = "5") int pageSize,
            Integer wareHouseId,Integer productId){
        return Result.success(inventoryService.selectByCondition(pageNum,pageSize,wareHouseId,productId));
    }

}
